package com.net.xpay.stat.task;

import com.net.xpay.common.domain.DailyTaskRecord;
import com.net.xpay.common.enums.systemTask.DailyTaskName;
import com.net.xpay.common.service.DailyTaskService;
import com.net.xpay.common.service.UserSafePayTransStatService;
import com.net.xpay.common.service.impl.AbstractDailyTaskService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 net
 * @description: 用户每天转账金额和次数定时任务
net
 * @create: 2020-09-09 22:29
 **/
@Service
@Slf4j
public class UserSafePayTransStatDailyTask extends AbstractDailyTaskService implements DailyTaskService {

    @Autowired
    private UserSafePayTransStatService userSafePayTransStatService;


    @Override
    protected String getDailyTaskName() {
        return DailyTaskName.USER_SAFE_PAY_TRANS_STAT;
    }

    @Override
    protected boolean doWorkByDayInternal(DailyTaskRecord record) {
        log.warn("start userSafePayTransStatDailyTask|day={}", record.getDay());
        userSafePayTransStatService.doUserSafePayTransStat(record.getDay());
        log.warn("end userSafePayTransStatDailyTask|day={}", record.getDay());
        return true;
    }

    @Override
    protected int getFirstStartDayDiff() {
        return 7;
    }


}